import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        loginStatic:false,
        info:{}
    },
    mutations: {
        // 初始化登录状态
        initUser(state){
        	let info = uni.getStorageSync('info')
        	if(info){
        		state.info = info
        		state.loginStatic = true
        	}
        },
        getUserInfo(state,data){
            state.info = data
            state.loginStatic = true
            uni.setStorageSync('loginStatic',true)
            uni.setStorageSync('info',data)
        },
        logout(state){
            console.log('vuex退出登陆')
            state.loginStatic = false
            state.info = {}
            uni.clearStorageSync('loginStatic')
            uni.clearStorageSync('info')
        }
    },
    actions: {
        
    }
})
export default store